﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Forum.Web.BaseCode;

namespace Forum.Web.Filters
{
    public class CheckLoginFilter: FilterAttribute, IActionFilter
    {
        #region IActionFilter Members

        public void OnActionExecuted(ActionExecutedContext filterContext)
        {
            MemberLoginInfo member = new MemberLoginInfo();
            if (member.IsLogin == false)
            {
                filterContext.Result = new RedirectResult(ForumPath.VirtualRoot + "Member/Login");
            }
        }

        public void OnActionExecuting(ActionExecutingContext filterContext)
        {
            //throw new NotImplementedException();
        }

        #endregion
    }
}